


@extends('admin._layouts.default')

@section('main')


      <div class="row-fluid ">
        <div class="span12 box gradient ">
      <div class="title">
            <div class="row-fluid">
                <h3><a href="{{ route('admin.commodities.create') }}"  class="btn btn-info btn-mini pull-right mg5"><i class="fa fa-edit"></i> 新增商品</a>
                  <i class="fa fa-shopping-cart"></i> 积分商城管理
                </h3>
            </div>
        </div><!-- End .title -->
        <div class="content min_h500">

            <table id="datatable_in" class="responsive table table-striped" style="width:100%;margin-bottom:0; ">
              <thead>
               <tr>
                 <th width="80">
                   缩略图
                  </th>
                  <th width="160">
                    名称
                  </th>
                  <th>
                    价格/积分
                  </th>
                  <th width="120">
                   有效期
                  </th>
                  <th width="120">
                   原价
                  </th>
                 <th width="160">
                   销量/库存
                 </th>
                 <th width="160">
                   操作
                 </th>
               </tr>
              </thead>
              <tbody>
              @foreach($commodities as $commodity)
               <tr>
                  <td>
                   <img class="thumbnail small" src="{{ $PATH }}{{ $commodity->cover }}">
                  </td>
                 <td>
                    {{ $commodity->name }}
                  </td>
                  <td>
                    <i class="fa fa-cny"></i> {{ $commodity->member_price }} / <i class="fa fa-credit-card"></i> {{ $commodity->member_points }}<br/>
                 </td>
                 <td>
                    @if($commodity->life){{ $commodity->life }}个月@endif
                 </td>
                 <td>
                    <i class="fa fa-cny"></i> {{ $commodity->public_price }}
                 </td>
                 <td>
                    <i class="fa fa-truck"></i> 200 / <i class="fa fa-cubes"></i> {{ $commodity->number }}<br/>
                 </td>
                 <td>
                    <div class="btn-group1">
                      <a class="btn btn-small" href="{{ URL::route('admin.commodities.edit', $commodity->id) }}" rel="tooltip" data-placement="left" data-original-title="编辑"><i class="gicon-edit"></i></a>
                      <a class="btn btn-small" rel="tooltip" data-placement="left" data-original-title="下架"><i class="gicon-pause"></i></a>
                     <a class="btn btn-inverse btn-small" onclick="set_delete('{{ $commodity->id }}');"  rel="tooltip" data-placement="bottom" data-original-title="删除宝贝" data-toggle="modal" data-target="#confirm_alert"><i class="gicon-remove icon-white"></i></a>
                   </div>
                 </td>
               </tr>
               @endforeach

               </tbody>
            </table>
                <div class="row-fluid control-group">

                    <div class="pagination pull-right ">
                    {{ $commodities->links() }}
                    </div>
                </div>
                <br/>


            </div>
        </div>
        <!-- End box -->
      </div>

@stop
@section('modals')
<div id="confirm_alert" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
  <form action="{{ route('admin.commodities.deleteit') }}" id="form_delete" method="post">
    <div class="modal-content">
      <div class="modal-header">
      <input type="hidden" name="delete_id" id="delete_id" value="">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">确定本次操作吗？</h3>
      </div>
      <div class="modal-body">
        <i class=" icon-warning-sign color_red pull-left fs_24"></i>

        <p>一旦【确定】，本次操作不可撤销。</p>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" onclick="delete_it();" class="btn btn-primary">确定</button>
      </div>
    </div>
    </form>
  </div>
</div>
@stop


@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/jquery.peity.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/jquery.uniform.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>

<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/plugins/flot/jquery.flot.js') }}"></script>



<script src="{{ URL::asset('web/js/scripts.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('web/js/jnavigate.jquery.min.js') }}"></script>
<script>
    function set_delete(id){
        $('#delete_id').val(id);
    }
    function delete_it(){
        $('#form_delete').submit();
    }
    </script>
</script>
@stop
